package com.d3works.apps.supplychain.service;

import com.d3works.apps.base.db.Partner;
import com.d3works.apps.base.db.Product;
import com.d3works.apps.purchase.db.PurchaseOrder;
import com.d3works.apps.stock.db.StockLocation;
import com.d3works.apps.supplychain.db.Mrp;
import com.d3works.apps.supplychain.db.MrpLine;
import com.d3works.apps.supplychain.db.MrpLineOrigin;
import com.d3works.apps.supplychain.db.MrpLineType;
import com.d3works.db.Model;
import com.d3works.exception.D3worksException;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;

public interface MrpLineService {

  void generateProposal(MrpLine mrpLine) throws D3worksException;

  void generateProposal(
      MrpLine mrpLine,
      Map<Pair<Partner, LocalDate>, PurchaseOrder> purchaseOrders,
      Map<Partner, PurchaseOrder> purchaseOrdersPerSupplier,
      boolean isProposalsPerSupplier)
      throws D3worksException;

  MrpLine createMrpLine(
      Mrp mrp,
      Product product,
      int maxLevel,
      MrpLineType mrpLineType,
      BigDecimal qty,
      LocalDate maturityDate,
      BigDecimal cumulativeQty,
      StockLocation stockLocation,
      Model model);

  MrpLineOrigin createMrpLineOrigin(Model model);

  MrpLineOrigin copyMrpLineOrigin(MrpLineOrigin mrpLineOrigin);

  void updateProposalToProcess(List<Integer> mrpLineIds, boolean proposalToProcess);

  void updateProposalToProcess(MrpLine mrpLine, boolean proposalToProcess);
}
